package com.example.demo.model;

import java.util.concurrent.ScheduledFuture;

/**
 * @author yujie
 */
public class TaskSession {

    private final ScheduledFuture<?> future;

    public TaskSession(ScheduledFuture<?> future) {
        this.future = future;
    }

    /**
     * 取消定时任务
     */
    public void cancel() {
        if (this.future != null) {
            future.cancel(true);
        }
    }

}
